﻿@model EnterpriseFund.Model.AllowanceApplicationForm
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title></title>
    @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery-ui.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
    <script type="text/javascript">

        $(document).ready(function () {
            $("#toolMenu").smartFloat();
            $("#tabs").tabs();
            var hdjsAlert = $("#hdjsAlert").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
            }
            if (hdjsAlert == "操作成功") {
                lpModal.Hide();
                window.location.href = rootPath + '/SpecificAdjustManage/';
            }
        });

        function Save() {
            var fFamountLeave = FamountLeave.GetText();
            var fFamount1 = Famount1.GetText();
            fFApplicationFormID = FApplicationFormID.GetText();
           // var fId = FPayCertNo.GetText();
            var fFPayCertNo = FPayCertNo.GetText();
            var fFNote = FNote1.GetText();

            if (pd(fFamount1, fFPayCertNo)) {
                if (!isNaN(fFamount1)) {
                    var f1 = parseFloat(fFamountLeave);
                    var f2 = parseFloat(fFamount1);
                    if (f1 >= f2) {
                        $.ajax({
                            type: 'POST',          /// DLBZ ZLBZ XLBZ FLLX
                            url: rootPath + '/AllowancePay/Save',
                            data: { Famount: fFamount1, FApplicationFormID: fFApplicationFormID,  FNote: fFNote, FPayCertNo: fFPayCertNo },
                            success: function (result) {
                               // lpModal.Hide();
                                if (result == "exists") {
                                    FId.SetErrorText("拨款号已存在");
                                    FId.SetIsValid(false);
                                } else if (result == "ok") {
                                    alert("拨款成功！");
                                    window.location.href = rootPath + '/AllowancePay/Index'
                                } else if (result == "error") {
                                    alert("保存失败");
                                }
                            }
                        });

                    }
                    else {
                        Famount1.SetErrorText("金额不能大于剩余资金!");
                        Famount1.SetIsValid(false);

                    }
                }
                else {
                    Famount1.SetErrorText("只能填写数字!");
                    Famount1.SetIsValid(false);
                }
            }
        }
        function pd(codeNo,codeNo1) {
            var bl = true;

            if (null == codeNo || ASPxClientUtils.Trim(codeNo) == "") {
                Famount1.SetErrorText("请输入拨付金额!");
                Famount1.SetIsValid(false);
                bl = false;
            }
            return bl;
        }
        function search(s) {
            window.location.href = rootPath + "/AllowancePay/AllowancePayEdit?FApplicationFormID=" + s
        }

        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
        }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        Save();
                        break;
                    }
                case "btncancel":
                    {
                        window.location.href = rootPath + '/AllowancePay/Index'
                        break;
                    }
            }

        }

        function codeEdits(id) {
            $.ajax({
                type: 'POST',          /// DLBZ ZLBZ XLBZ FLLX
                url: rootPath + '/AllowancePay/AllowancePayEdits',
                data: { FApplicationFormID: id },
                success: function (result) {
                    FamountLeave.SetText(result.split(':')[0]);
                    Famount1.SetText(result.split(':')[0]);
                    Famount.SetText(result.split(':')[1]);
                }
            });
            
        }

    </script>
</head>
<body>
    @using (Html.BeginForm("Save", "SpecificAdjustManage", FormMethod.Post, new { id = "form1" }))
    {
        @Html.DevExpress().Menu(settings =>
   {
       settings.Name = "toolBarMenu";
       settings.ItemAutoWidth = false;
       settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
       settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
       settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
       settings.Items.Add(item =>
       {
           item.Name = "btnSave";
           item.Text = "拨款";
           item.Image.Url = Url.Content("~/Content/ControlImages/business_contact.png");
       });
       
              settings.Items.Add(item =>
       {
           item.Name = "btncancel";
           item.Text = "返回";
           item.Image.Url = Url.Content("~/Content/ControlImages/back.png");
       });
       settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
       settings.ItemLinkMode = ItemLinkMode.ContentBounds;
   }).GetHtml()
       
@*<table align="center" style=" width:500px" class="tableForm">
        <tr>
            <td style=" width:150px; text-align:right; vertical-align:middle"  class="tdClass">
               纳税人编码:</td>
            <td style="text-align:right; vertical-align:middle"  class="tdClass">
           @Html.DevExpress().TextBox(settings =>
      {
          settings.Name = "NSRBMQ";
          settings.Width = 200;
          settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
          settings.Properties.ValidationSettings.EnableCustomValidation = true;
      }).GetHtml()
            </td>
            <td style=" width:150px; text-align:left; vertical-align:middle"  class="tdClass">
             @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnSearch";
                settings.Text = "查询";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
                settings.ClientSideEvents.Click = "search";
            }).GetHtml()

        @*     @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnUndo";
                settings.Text = "重置";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/undo_blue.png");
                settings.ClientSideEvents.Click = "undo";
            }).GetHtml()</td></tr> 

            
    </table>
    <br />*@
        <table align="center" class="tableForm">
            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                    拨付受理号：
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "FApplicationFormID";
                   settings.Text = (Model.FApplicationFormID == null) ? "" : Model.FApplicationFormID;
                   settings.Properties.Style.ForeColor = System.Drawing.Color.Gray;
                   //settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                   <td align="right" style="width: 150px" class="tdClass">
                    纳税人名称：
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "NSRMC";
                   settings.Text = Model.NSRMC;
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                    文件号：
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "FFileNo";
                   settings.Text = Model.FFileNo;
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                 <td align="right" style="width: 150px" class="tdClass">
                    可拨付资金：
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "FAuditAmount";
                   settings.Text = Model.FAuditAmount.ToString();
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                    已拨付资金:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "Famount";
                   settings.Text = Model.FamountStr;
                   settings.Properties.Style.ForeColor = System.Drawing.Color.Gray;
                   //ForeColor = System.Drawing.Color.Gray;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                  <td align="right" style="width: 150px" class="tdClass">
                    剩余资金:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "FamountLeave";
                   settings.Text = Model.FamountLeaveStr;
                   settings.Properties.Style.ForeColor = System.Drawing.Color.Gray;
                   settings.Width =200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            @*        <tr>
    <td align="right" style=" width:150px" class="tdClass">
    调整类型:
    </td>
    <td  class="tdClass">
    @Html.DevExpress().ComboBox(settings =>
{
    settings.Name = "FSpecialAdjustClsNo";
    settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
    settings.Width = 300;
    settings.Properties.TextField = "FSpecialAdjustName";
    settings.Properties.ValueField = "FSpecialAdjustClsNo";
}).BindList(ViewData["SpecialAdjustClsList"]).Bind(Model.FSpecialAdjustClsNo).GetHtml()
              
    </td>
    </tr> *@
            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                    备注:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "FNote";
                   settings.Text = Model.FNote;
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                <td align="right" style="width: 150px" class="tdClass">
                   银行:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Name = "KHYH";
                   settings.Text = Model.KHYH;
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                  拨款凭证号:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   //settings.ReadOnly = true;
                   settings.Name = "FPayCertNo";
                   //settings.Text = Model.FNote;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                  <td align="right" style="width: 150px" class="tdClass">
                    拨付资金
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "Famount1";
                   settings.Text =Model.FamountLeaveStr;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
@*                        <tr>
                <td align="right" style="width: 150px" class="tdClass">
                  公司编码:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
 {
     //settings.ReadOnly = true;
     settings.Name = "FPayCertNo";
     //settings.Text = Model.FNote;
     settings.Width = 300;
     settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
     settings.Properties.ValidationSettings.EnableCustomValidation = true;
 }).GetHtml()
                </td>
            </tr>*@

            <tr>
                <td align="right" style="width: 150px" class="tdClass">
                    拨款备注:
                </td>
                <td class="tdClass" >
                    @Html.DevExpress().TextBox(settings =>
               {
                   //settings.ReadOnly = true;
                   settings.Name = "FNote1";
                   //settings.Text = Model.FNote;
                   settings.Width = 200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
                   <td align="right" style="width: 150px" class="tdClass">
                   拨付日期:
                </td>
                <td class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.ReadOnly = true;
                   settings.Enabled = false;
                   settings.Name = "date";
                   settings.Text = DateTime.Now.ToString("yyyy年MM月dd日");
                   settings.Properties.Style.ForeColor = System.Drawing.Color.Gray;
                   settings.Width =200;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
        </table>
        <br />
        <div id="tabs" class="div">
            <ul>
                <li><a href="#TaxData">历史拨付记录
</a></li>
            </ul>
            <div id="TaxData" style="height: 550px">
                <iframe  id='contentleft' name='contentleft' style='width:100%;height:100%' frameborder='0' src='@Url.Action("FormerYearAllowancePayShow", "AllowancePay", new { FApplicationFormID = Model.FApplicationFormID })'>
                </iframe>
            </div>
        </div> 

        @Html.Hidden("hidType", ViewData["type"])
        @Html.Hidden("NSRBM", ViewData["NSRBM"])
        @Html.Hidden("NSRDZDAH", Model.NSRDZDAH)
@*        @Html.Hidden("FSpecificAdjustNo", Model.FSpecificAdjustNo)*@
        @Html.Hidden("FYear", Model.FYear)
@*        @Html.Hidden("FEnterprisePropNo", Model.FEnterprisePropNo)*@
        @Html.Hidden("FFinancePropNo", Model.FFinancePropNo)
        @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))
    }
    @*@Html.DevExpress().PageControl(
    settings =>
    {
        settings.Name = "tabCtlGroup";
        settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
        //settings.Height = System.Web.UI.WebControls.Unit.Pixel(600);
        settings.Styles.Content.Border.BorderWidth = 0;
        settings.TabPages.Add("税款数据").SetContent("<iframe  id='contentleft' name='contentleft' style='width:100%;height:100%' frameborder='0' src='" + Url.Action("TaxAuditFormShowDate", "TaxAuditForm", new { NSRBM = ViewData["NSRBM"], beginDate = ViewData["beginDate"], endDate = ViewData["endDate"] }) + "'></iframe>");
        settings.TabPages.Add("调整数据").SetContent("<iframe  id='contentleft' name='contentleft' style='width:100%;height:100%' frameborder='0' src='" + Url.Action("TaxAuditAdjustIndex", "TaxAuditForm") + "'></iframe>");
    }).GetHtml()
*@
    <script>
        lp.Hide();
    </script>
</body>
</html>
